<?php

class EchoTag extends SmEngine implements ISmEngine
{
    protected  $_Open = '\$';
    protected  $_Close = FALSE;

    public function render()
    {

        return "<?php echo \$" . $this->parseVar($this->_tag) . "; ?>";
    }

    private function parseVar($var)
    {
        $s = explode('.', $var);
        $var = $s[0];
        array_shift($s);
        foreach ($s as $l) {
            $var .= "['{$l}']";
        }
        return $var;
    }
}